import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { RootState } from "..";
import { getSysUserPage } from "@/api/sys/sysUser";

// 定义初始状态
const initialState = {
  
  sysUserPage: {} as PageType<SysUserInfoType>,
};



export const get_sys_user_page = createAsyncThunk<PageType<SysUserInfoType>>(
  "get/get_sys_user_page",
  async (action: any, state) => {
    return await getSysUserPage(action);
  }
);

export const userSlice = createSlice({
  name: "users",
  initialState,
  reducers: {
  
  },
  extraReducers(builder) {
    builder
    
      .addCase(get_sys_user_page.fulfilled, (state, action) => {
        state.sysUserPage = action.payload;
      });
  },
});

export const selectUserSysUserPage = (state: RootState) =>
  state.user.sysUserPage;


export default userSlice.reducer;
